﻿@model SportsStore.Domain.Entities.Product

@{
    ViewBag.Title = "Admin: Edit " + @Model.Name;
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

<h2>Edit @Model.Name</h2>
@{
    // The changes effects only this view. By setting this in App_Start, the changes will affect entire app.
    // HtmlHelper.ClientValidationEnabled = false;
    // HtmlHelper.UnobtrusiveJavaScriptEnabled = false;  
}
@using (Html.BeginForm("Edit", "Admin", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.EditorForModel()

    <div class="editor-label">Image</div>
    <div class="editor-field">
        @if (Model.ImageData == null)
        {
            @:None
        }
        else
        {
         <img width="150" height="150" src="@Url.Action("GetImage", "Product", new { Model.ProductID })" />   
        }
        <div>Upload new image: <input type="file" name="Image" /></div>
    </div>
    
    <input type="submit" value="Save" />
    @Html.ActionLink("Cancel and return to List", "Index")
}
